package com.io.example.demoparent.queue;

import java.util.Scanner;

/**
 *     普通队列
 */
public class ArrayQueueDemo {

    public static void main(String[] args) {
        ArrayQueue arrayQueue = new ArrayQueue(5);
         char key=' ';
        Scanner scanner = new Scanner(System.in);
        boolean loop=true;
        while (loop){
            System.out.println("s(show): 显示队列");
            System.out.println("e(exit): 退出队列");
            System.out.println("a(add): 添加数据到队列");
            System.out.println("g(get): 从队列中获取数据");
            System.out.println("k(keep): 查看队列头数据");
            key=scanner.next().charAt(0);
              switch (key){
                  case 's':
                      arrayQueue.showQueue();
                      break;
                  case 'e':
                      loop=false;
                      break;
                  case 'a':
                      System.out.println("输出一个数");
                      int anInt = scanner.nextInt();
                      arrayQueue.addQueue(anInt);
                      break;
                  case 'g':
                        arrayQueue.getQueue();
                      break;
                  case 'k':
                      int peekQueue = arrayQueue.peekQueue();
                      System.out.println(peekQueue);
                      break;
                  default:
                      break;

              }
        }


    }
}

